package com.xiao.mall.message.service.mapper;

import com.xiao.mall.foundation.mapper.EntityMapper;
import com.xiao.mall.message.domain.UserNotification;
import com.xiao.mall.message.service.dto.UserNotificationDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

@Mapper(componentModel = "spring",
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface UserNotificationMapper extends EntityMapper<UserNotificationDto, UserNotification> {

    @Override
    @Mapping(target = "notification.id", source = "notificationId")
    UserNotification toEntity(UserNotificationDto dto);

    @Override
    @Mapping(target = "notificationId", source = "notification.id")
    UserNotificationDto toDto(UserNotification entity);
}
